<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="t_hire" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 招聘信息 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="招聘标题" prop="hire_title">
              <el-input v-model="t_hire.hire_title" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="招聘岗位" prop="hire_station">
              {{t_hire.hire_station}}
              <el-button @click="popChoicePost('hire_station','hire_station')" type="success" size="mini"><i class="fa fa-edit"></i>选择</el-button>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="招聘人数" prop="hire_peonum">
              <el-input v-model="t_hire.hire_peonum" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="上岗时间" prop="hire_dedate">
              <el-date-picker v-model="t_hire.hire_dedate" type="date" style='width:100%' value-format="yyyy-MM-dd" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="内容" prop="hire_des">
              <el-input type="textarea" v-model="t_hire.hire_des" ttparea=350></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-button @click="revisionPostSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
      <el-button @click="gotoPage('/oa/humanresources/RecruitmentInformation?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
    </el-form>
    <el-dialog :visible.sync="ChoicePostVisible" append-to-body>
      <ChoicePost v-if="ChoicePostVisible" ref="ChoicePost" :popparams="popparams"> </ChoicePost>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import ChoicePost from "@/views/oa/humanresources/ChoicePost";
  export default {
    name: 'RevisionPost',
    components: {
      ChoicePost,
    },
    props: ['popparams'],
    data() {
      return {
        ChoicePostVisible: false,
        ChoicePostValue: null,
        ChoicePostDesc: null,
        vueparams: this.getVUEParams(""),
        t_hire: {
          hire_title: null,
          hire_station: null,
          hire_peonum: null,
          hire_dedate: null,
          hire_des: null,
        },
        loading: false,
        rules: {
          hire_title: [{
            required: true,
            message: "招聘标题不能为空",
            trigger: 'blur',
          }],
          hire_station: [{
            required: true,
            message: "招聘岗位不能为空",
            trigger: 'change',
          }],
          hire_peonum: [{
            required: true,
            message: "招聘人数不能为空",
            trigger: 'blur',
          }],
        }
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/oa/humanresources/InterviewInfoAction/revisionPost?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      revisionPostSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/oa/humanresources/InterviewInfoAction/revisionPostSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/oa/humanresources/RecruitmentInformation/recruitmentInformation?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
      popChoicePost(desc, value) {
        this.ChoicePostVisible = true;
        this.ChoicePostDesc = desc;
        this.ChoicePostValue = value;
      },
      closeChoicePost(value, desc) {
        this.ChoicePostVisible = false;
        this.$set(this.t_hire, this.ChoicePostDesc, desc);
        this.$set(this.t_hire, this.ChoicePostValue, value);
      },
    },
  }
</script>
